<?php
/**
 * Created by IntelliJ IDEA.
 * User: Kmontyjack
 * Date: 23.11.11
 * Time: 14:19
 * To change this template use File | Settings | File Templates.
 */
class Admin_SearchController extends Zend_Controller_Action
{

    public function init()
    {

    }


    public function indexAction()
    {
        $form = new Admin_Form_Hledat();

        if ($this->getRequest()->isPost() && (false !== $this->getRequest()->getPost('hledej', false))) {
               try{
                    $post = $form->getValues();

                    $kniha = new Knihovna_Model_SearchKniha();
                    $kniha->Hledej_knihu($post['kniha']);

                    $autor = new Knihovna_Model_SearchAutor();
                    $autor->Hledej_autora($post['autor']);

                }catch(Exception $error){
                    $this->_helper->flashMessenger('error|'.$error->getMessage());
                }

        }

        $this->view->form = $form;
    }
}


